package srzy

import org.junit.Assert._
import org.junit.Test
import srzy.common.Logging
import srzy.module.RefreshSM
import net.sf.jsqlparser.parser.CCJSqlParserManager
import java.io.StringReader
import net.sf.jsqlparser.statement.update.Update

class test2 extends Logging {

  @Test
  def test1() {
    val l = List("")
    val parserManager = new CCJSqlParserManager()

    val ll = l.map(x => parserManager.parse(new StringReader(x)) match {
      case s: Update => Some(s.getTable().getName())
      case _ => logger.error("sql is not update clouse : " + x); None
    }).map(e => e match {
      case Some(v) => RefreshSM.refreshTableMap.get(v)
      case None => None
    })
    val refreshList = if (ll.contains(None)) {
      List("1")
    } else {
      ll.filter(_ != None).map(_.get)
    }
    
    
  }

}